<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta name="description" content="C++中的operator_new和placement_new"><meta name="keywords" content="C++"><meta name="author" content="LiYang"><meta name="copyright" content="LiYang"><title>C++中的operator_new和placement_new | 一条鲤鱼</title><link rel="shortcut icon" href="/melody-favicon.ico"><link rel="stylesheet" href="/css/index.css?version=1.9.0"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css?version=1.9.0"><meta name="format-detection" content="telephone=no"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  hexoVersion: '5.4.0'
} </script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="一条鲤鱼" type="application/atom+xml">
</head><body><i class="fa fa-arrow-right" id="toggle-sidebar" aria-hidden="true"></i><div id="sidebar" data-display="true"><div class="toggle-sidebar-info text-center"><span data-toggle="Toggle article">Toggle site</span><hr></div><div class="sidebar-toc"><div class="sidebar-toc__title">Catalog</div><div class="sidebar-toc__progress"><span class="progress-notice">You've read</span><span class="progress-num">0</span><span class="progress-percentage">%</span><div class="sidebar-toc__progress-bar"></div></div><div class="sidebar-toc__content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#C-%E4%B8%AD%E7%9A%84operator-new%E5%92%8Cplacement-new"><span class="toc-number">1.</span> <span class="toc-text">C++中的operator new和placement new</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-new%E7%9A%84%E4%B8%89%E7%A7%8D%E9%9D%A2%E8%B2%8C"><span class="toc-number">1.1.</span> <span class="toc-text">1.new的三种面貌</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-1new-operator"><span class="toc-number">1.1.1.</span> <span class="toc-text">1.1new operator</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2-operator-new"><span class="toc-number">1.1.2.</span> <span class="toc-text">1.2 operator new()</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-3-placement-new-%EF%BC%9A"><span class="toc-number">1.1.3.</span> <span class="toc-text">1.3 placement new()：</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E4%BA%86%E8%A7%A3delete%E5%92%8Coperator-delete"><span class="toc-number">1.2.</span> <span class="toc-text">2.了解delete和operator delete()</span></a></li></ol></li></ol></div></div><div class="author-info hide"><div class="author-info__avatar text-center"><img src="/img/avatar.png"></div><div class="author-info__name text-center">LiYang</div><div class="author-info__description text-center"></div><hr><div class="author-info-articles"><a class="author-info-articles__archives article-meta" href="/archives"><span class="pull-left">Articles</span><span class="pull-right">13</span></a><a class="author-info-articles__tags article-meta" href="/tags"><span class="pull-left">Tags</span><span class="pull-right">6</span></a><a class="author-info-articles__categories article-meta" href="/categories"><span class="pull-left">Categories</span><span class="pull-right">7</span></a></div></div></div><div id="content-outer"><div class="no-bg" id="top-container"><div id="page-header"><span class="pull-left"> <a id="site-name" href="/">一条鲤鱼</a></span><i class="fa fa-bars toggle-menu pull-right" aria-hidden="true"></i><span class="pull-right menus">   <a class="site-page" href="/">Home</a><a class="site-page" href="/archives">Archives</a><a class="site-page" href="/tags">Tags</a><a class="site-page" href="/categories">Categories</a></span><span class="pull-right"></span></div><div id="post-info"><div id="post-title">C++中的operator_new和placement_new</div><div id="post-meta"><time class="post-meta__date"><i class="fa fa-calendar" aria-hidden="true"></i> 2022-04-18</time><span class="post-meta__separator">|</span><i class="fa fa-inbox post-meta__icon" aria-hidden="true"></i><a class="post-meta__categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/">编程语言</a><i class="fa fa-angle-right" aria-hidden="true"></i><i class="fa fa-inbox post-meta__icon" aria-hidden="true"></i><a class="post-meta__categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/C/">C++</a></div></div></div><div class="layout" id="content-inner"><article id="post"><div class="article-container" id="post-content"><h1 id="C-中的operator-new和placement-new"><a href="#C-中的operator-new和placement-new" class="headerlink" title="C++中的operator new和placement new"></a>C++中的operator new和placement new</h1><h2 id="1-new的三种面貌"><a href="#1-new的三种面貌" class="headerlink" title="1.new的三种面貌"></a>1.new的三种面貌</h2><p>C++中使用new运算符产生一个存在于Heap（堆）上对象时，实际上调用了operator new()函数和placement new()函数。在使用new创建堆对象时，我们要清楚认清楚new的三种面貌，分别是：new operator、operator new()和placement new()。placement new()也称为定位构造对象。</p>
<h3 id="1-1new-operator"><a href="#1-1new-operator" class="headerlink" title="1.1new operator"></a>1.1new operator</h3><p>new operator是C++保留的关键字，我们无法改变其含义，但我们可以改变new完成它功能时调用的两个函数，<strong>operator new()和placement new()<strong>。</strong>也就是说我们在使用运算符new时，其最终是通过调用operator new()和placement new()来完成堆对象的创建工作</strong>。使用new operator时，其完成的工作有如下三步： </p>
<p><img src="/2022/04/18/C-%E4%B8%AD%E7%9A%84operator-new%E5%92%8Cplacement-new/1.png" alt="img"></p>
<p>因此，当我们经常按照如下方式使用new operator时：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">string* sp=<span class="keyword">new</span> <span class="built_in">string</span>(“hello world”);</span><br></pre></td></tr></table></figure>

<p>实际上等价于：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//第一步：申请原始空间，行为类似于malloc</span></span><br><span class="line"><span class="keyword">void</span>* raw=<span class="keyword">operator</span> <span class="built_in"><span class="keyword">new</span></span>(<span class="built_in">strlen</span>(“hello world”));</span><br><span class="line"><span class="comment">//第二步：通过placement new调用string类的构造函数，初始化申请空间</span></span><br><span class="line"><span class="keyword">new</span> (raw) <span class="built_in">string</span>(“hello world”);</span><br><span class="line"><span class="comment">//第三部：返回对象指针</span></span><br><span class="line">string* sp=<span class="keyword">static_cast</span>&lt;string*&gt;(raw);</span><br></pre></td></tr></table></figure>

<h3 id="1-2-operator-new"><a href="#1-2-operator-new" class="headerlink" title="1.2 operator new()"></a>1.2 operator new()</h3><p><strong>operator new()用于申请Heap空间，功能类似于C语言的库函数malloc()，尝试从堆上获取一段内存空间，如果成功则直接返回，如果失败则转而去调用一个new handler，然后抛出一个bad_alloc异常。</strong>operator new()的函数原型一般为</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span>* <span class="keyword">operator</span> <span class="title">new</span> <span class="params">(std::<span class="keyword">size_t</span> size)</span> <span class="title">throw</span> <span class="params">(std::bad_alloc)</span></span>;</span><br></pre></td></tr></table></figure>

<p>具体实现如下：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span> *__CRTDECL <span class="keyword">operator</span> <span class="title">new</span><span class="params">(<span class="keyword">size_t</span> size)</span> <span class="title">throw</span> <span class="params">(std::bad_alloc)</span></span></span><br><span class="line"><span class="function"></span>&#123;       </span><br><span class="line">    <span class="comment">// try to allocate size bytes</span></span><br><span class="line">    <span class="keyword">void</span> *p;</span><br><span class="line">    <span class="keyword">while</span> ((p = <span class="built_in">malloc</span>(size)) == <span class="number">0</span>)      <span class="comment">//申请空间</span></span><br><span class="line">        <span class="keyword">if</span> (_callnewh(size) == <span class="number">0</span>)        <span class="comment">//若申请失败则调用处理函数</span></span><br><span class="line">        &#123;       </span><br><span class="line">            <span class="comment">// report no memory</span></span><br><span class="line">            <span class="keyword">static</span> <span class="keyword">const</span> std::bad_alloc nomem;</span><br><span class="line">            _RAISE(nomem);               <span class="comment">//#define _RAISE(x) ::std:: _Throw(x) 抛出nomem的异常</span></span><br><span class="line">        &#125;</span><br><span class="line">    <span class="keyword">return</span> (p);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><strong>注意：</strong>  </p>
<p>（1）函数后添加throw表示可能会抛出throw后括号内的异常；  </p>
<p>（2）operator new()分为全局和类成员。当为类成员函数时，使用new产生类对象时调用的则是其成员函数operator new()。如果要重载全局的operator new会改变所有默认的operator new的方式，所以必须要注意。正如new与delete相互对应，operator new与operator delete也是一一对应，<strong>如果重载了operator new，那么理应重载operator delete。</strong></p>
<h3 id="1-3-placement-new-："><a href="#1-3-placement-new-：" class="headerlink" title="1.3 placement new()："></a>1.3 <strong>placement new()：</strong></h3><p> 一般来说，使用new申请空间时，是从系统的堆中分配空间，申请所得空间的位置根据当时内存实际使用情况决定。但是，在某些特殊情况下，可能需要在程序员指定的特定内存创建对象，这就是所谓的“定位放置new”（placement new）操作。<strong>placement new()是一个特殊的operator new()<strong>，因为其是operator new()函数的重载版本，只是取了个别名叫作placement new罢了。</strong>作用是在已经获得的堆空间上调用类构造函数来初始化对象，也就是定位构造对象。</strong>通常情况下，构造函数是由编译器自动调用的，但是不排除程序员手动调用的可能性，比如对一块未初始化的内存进行处理，获得想要的对象，这是需要求助于placement new()。<strong>placement new()是C++标准库的一部分，被申明在头文件<code>&lt;new&gt;</code>中</strong>，其函数原型是：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span>* <span class="keyword">operator</span> <span class="title">new</span><span class="params">(std::<span class="keyword">size_t</span>, <span class="keyword">void</span>* __p)</span></span>;</span><br></pre></td></tr></table></figure>

<p>具体实现如下：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span>* <span class="keyword">operator</span> <span class="title">new</span><span class="params">(std::<span class="keyword">size_t</span>, <span class="keyword">void</span>* __p)</span> <span class="title">throw</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">return</span> __p;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><strong>注意：</strong>  </p>
<p>（1）placement new()的函数原型不是</p>
<p><code>void* placement new(std::size_t, void* __p)</code>;  </p>
<p>（2）placement new只是operator new()的一个重载，多了一个已经申请好的空间，由void* __p指定；  </p>
<p>（3）用法是<code>new (addr) constructor()</code>，对addr指定的内存空间调用构造函数进行初始化。<strong>为何称为placement new，从其用法可以看出只是用于调用构造函数。</strong></p>
<p>定位放置new操作的语法形式不同于普通的new操作。例如，一般都用如下语句A* p=new A;申请空间，而定位放置new操作则使用如下语句A* p=new (ptr) A;申请空间，其中ptr就是程序员指定的内存首地址。考察如下程序。</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">A</span>&#123;</span></span><br><span class="line">    <span class="keyword">int</span> num;</span><br><span class="line"><span class="keyword">public</span>:</span><br><span class="line">    <span class="built_in">A</span>()&#123;</span><br><span class="line">        cout&lt;&lt;<span class="string">&quot;A&#x27;s constructor&quot;</span>&lt;&lt;endl;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    ~<span class="built_in">A</span>()&#123;</span><br><span class="line">        cout&lt;&lt;<span class="string">&quot;~A&quot;</span>&lt;&lt;endl;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">void</span> <span class="title">show</span><span class="params">()</span></span>&#123;</span><br><span class="line">        cout&lt;&lt;<span class="string">&quot;num:&quot;</span>&lt;&lt;num&lt;&lt;endl;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">    <span class="keyword">char</span> mem[<span class="number">100</span>];</span><br><span class="line">    mem[<span class="number">0</span>]=<span class="string">&#x27;A&#x27;</span>;</span><br><span class="line">    mem[<span class="number">1</span>]=<span class="string">&#x27;\0&#x27;</span>;</span><br><span class="line">    mem[<span class="number">2</span>]=<span class="string">&#x27;\0&#x27;</span>;</span><br><span class="line">    mem[<span class="number">3</span>]=<span class="string">&#x27;\0&#x27;</span>;</span><br><span class="line">    cout&lt;&lt;(<span class="keyword">void</span>*)mem&lt;&lt;endl;</span><br><span class="line">    A* p=<span class="built_in"><span class="keyword">new</span></span> (mem) A;</span><br><span class="line">    cout&lt;&lt;p&lt;&lt;endl;</span><br><span class="line">    p-&gt;<span class="built_in">show</span>();</span><br><span class="line">    p-&gt;~<span class="built_in">A</span>();</span><br><span class="line">    <span class="built_in">getchar</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>程序运行结果：  </p>
<p>0024F924  </p>
<p>A’s constructor </p>
<p>0024F924  </p>
<p>num:65  </p>
<p>~A</p>
<p>阅读以上程序，注意以下几点。  </p>
<p>（1）<strong>用定位放置new操作，既可以在栈(stack)上生成对象，也可以在堆（heap）上生成对象。</strong>如本例就是在栈上生成一个对象。</p>
<p>（2）<em><em>使用语句A</em> p=new (mem) A;定位生成对象时，指针p和数组名mem指向同一片存储区。所以，与其说定位放置new操作是申请空间，还不如说是利用已经请好的空间，真正的申请空间的工作是在此之前完成的。</em>*</p>
<p>（3）*<em>使用语句A <em>p=new (mem) A;定位生成对象时，会自动调用类A的构造函数，但是由于对象的空间不会自动释放（对象实际上是借用别人的空间），所以必须显示的调用类的析构函数，如本例中的p-&gt;~A()。</em></em></p>
<p>（4）<strong>万不得已才使用placement new，只有当你真的在意对象在内存中的特定位置时才使用它。</strong>例如，你的硬件有一个内存映像的I/O记时器设备，并且你想放置一个Clock对象在那个位置。</p>
<p><strong>总结：</strong>  </p>
<p>（1）<strong>若想在堆上建立一个对象，应该用new操作符。</strong>它既分配内存又调用其构造函数进行初始化。 </p>
<p>（2）<strong>若仅仅想分配内存，应该调用operator new()（当然malloc也是可以）,他不会调用构造函数</strong>。若想定制自己在堆对象被建立时的内存分配过程，应该重写自己的operator new()。  </p>
<p>（3）<strong>若想在一块已经获得的内存空间上建立一个对象，应该用placement new。</strong>虽然在实际开发过程中，很少需要重写operator new()，使用内置的operator new()即可完成大部分程序所需的功能。但知道这些，有助于一个C++程序猿对C++内存的管理有个清楚的认识。</p>
<hr>
<h2 id="2-了解delete和operator-delete"><a href="#2-了解delete和operator-delete" class="headerlink" title="2.了解delete和operator delete()"></a>2.了解delete和operator delete()</h2><p><strong>为了避免内存泄漏，每个动态内存分配必须与一个等同相反的 deallocation 对应。</strong></p>
<p>operator delete与delete操作符的关系与operator new与new操作符是一样的。<strong>delete用于使用使用new申请的空间，operator delete用于释放operator new申请的空间（类似于malloc与free）。</strong></p>
<p><strong>那谁来清理placement new初始化的内存内容呢？唯一办法就是调用对象的析构函数。</strong></p>
<p>示例代码：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">string* sp=<span class="keyword">new</span> <span class="built_in">string</span>(“hello world”);</span><br><span class="line"><span class="keyword">delete</span> sp;</span><br></pre></td></tr></table></figure>

<p>第一行代码在上文已经剖析，那么当调用delete sp时，发生了什么?</p>
<p>delete sp等价于：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ps-&gt;~<span class="built_in">string</span>(); <span class="comment">//用于清理内存内容，对应placement new</span></span><br><span class="line"><span class="function"><span class="keyword">operator</span> <span class="title">delete</span><span class="params">(ps)</span></span>;<span class="comment">//释放内存空间，对应于operator new()</span></span><br></pre></td></tr></table></figure>

<p>其中operator delete()的函数原型为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span> <span class="keyword">operator</span> <span class="title">delete</span><span class="params">(<span class="keyword">void</span> *memoryToBeDeallocated)</span></span>;</span><br></pre></td></tr></table></figure>



<hr>
<p><strong>总的来看，可以理解为，operator new()是用来申请足够的内存空间，而placement new()则是用来在申请好的内存空间中调用构造函数对内存空间进行初始化，是利用已经申请好的空间，并且这个空间可以是在栈上的。operator new申请的内存空间使用operator delete来释放，placement new借用的空间调用对象的析构函数来归还。</strong></p>
<p>参考文献：</p>
<p> [1]  Scott Meyers.More Effective C++（第三版）[M].北京：电子工业出版社，2011.1. </p>
<p> [2] <a href="**https://cloud.tencent.com/developer/article/1177460#:~:text=placement%20new%20()%E6%98%AFC++%E6%A0%87%E5%87%86%E5%BA%93%E7%9A%84%E4%B8%80%E9%83%A8%E5%88%86%EF%BC%8C%E8%A2%AB%E7%94%B3%E6%98%8E%E5%9C%A8%E5%A4%B4%E6%96%87%E4%BB%B6%20%3Cnew%3E%20%E4%B8%AD%EF%BC%8C%E5%85%B6%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B%E6%98%AF%EF%BC%9A,void*%20operator%20new(std::size_t,%20void*%20__p);**">C++ new的三种面貌</a></p>
</div></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">LiYang</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="http://example.com/2022/04/18/C-中的operator-new和placement-new/">http://example.com/2022/04/18/C-中的operator-new和placement-new/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/C/">C++</a></div><nav id="pagination"><div class="prev-post pull-left"><a href="/2022/04/18/Learn-Git-Branching/"><i class="fa fa-chevron-left">  </i><span>Learn_Git_Branching</span></a></div><div class="next-post pull-right"><a href="/2021/12/07/C-%E4%B8%AD%E7%9A%84new-delete%E5%92%8Cmalloc-free/"><span>C++中的new/delete和malloc/free</span><i class="fa fa-chevron-right"></i></a></div></nav></div></div><footer><div class="layout" id="footer"><div class="copyright">&copy;2013 - 2022 By LiYang</div><div class="framework-info"><span>Driven - </span><a target="_blank" rel="noopener" href="http://hexo.io"><span>Hexo</span></a><span class="footer-separator">|</span><span>Theme - </span><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/hexo-theme-melody"><span>Melody</span></a></div><div class="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_page_pv"><i class="fa fa-file"></i><span id="busuanzi_value_page_pv"></span><span></span></span></div></div></footer><i class="fa fa-arrow-up" id="go-up" aria-hidden="true"></i><script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@latest/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-ui-pack@latest/velocity.ui.min.js"></script><script src="/js/utils.js?version=1.9.0"></script><script src="/js/fancybox.js?version=1.9.0"></script><script src="/js/sidebar.js?version=1.9.0"></script><script src="/js/copy.js?version=1.9.0"></script><script src="/js/fireworks.js?version=1.9.0"></script><script src="/js/transition.js?version=1.9.0"></script><script src="/js/scroll.js?version=1.9.0"></script><script src="/js/head.js?version=1.9.0"></script><script>if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
  $('#nav').addClass('is-mobile')
  $('footer').addClass('is-mobile')
  $('#top-container').addClass('is-mobile')
}</script></body></html>